package com.company.huisuo.biz.activity

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import com.company.huisuo.base.BaseActivity
import com.company.huisuo.biz.adapter.SelectRoomAdapter
import com.company.huisuo.databinding.ActivitySelectRoomBinding

/**
 * 选择房间
 */
class SelectRoomActivity : BaseActivity<ActivitySelectRoomBinding>() {

    private val mAdapter by lazy {
        SelectRoomAdapter()
    }

    companion object {
        fun start(activity: AppCompatActivity) {
            activity.startActivity(Intent(activity, SelectRoomActivity::class.java))
        }
    }

    override fun initView() {
        mBinding.rcvList.apply {
            layoutManager = GridLayoutManager(this@SelectRoomActivity, 4)
            adapter = mAdapter
        }
        mBinding.tvOk.setOnClickListener {
            MainActivity.start(this)
        }
    }

    override fun initData() {
        val list = arrayListOf<String>()
        for (i in 1..4) {
            list.add("A00${i}房")
        }
        for (i in 1..4) {
            list.add("B00${i}房")
        }
        for (i in 1..4) {
            list.add("C00${i}房")
        }
        for (i in 1..4) {
            list.add("D00${i}房")
        }
        mAdapter.submitList(list)
    }
}